﻿namespace DG.Common.Patterns.MVVM
{
    public abstract class CRUDViewModelBase<T> : ViewModelBase
    {
        private CRUDOperationType _operationType;
        private T _entity;

        public CRUDOperationType OperationType
        {
            get { return _operationType; }
            set
            {
                if (value == _operationType) return;
                _operationType = value;
                OnPropertyChanged("OperationType");
            }
        }

        public T Entity
        {
            get { return _entity; }
            set
            {
                if (Equals(value, _entity)) return;
                _entity = value;
                OnPropertyChanged("Entity");
            }
        }
    }
}